-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#167730641 Notifying New Travel Request #20
base: develop
Are you sure you want to change the base?
Conversation
What is the issue you having here bro @ChidiChuks ? |
], {}); | ||
}, | ||
|
||
down: (queryInterface, Sequelize) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'Sequelize' is defined but never used no-unused-vars
@@ -0,0 +1,23 @@ | |||
module.exports = { | |||
up: (queryInterface, Sequelize) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'Sequelize' is defined but never used no-unused-vars
@@ -0,0 +1,23 @@ | |||
module.exports = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'module' is not defined no-undef
src/database/models/notifications.js
Outdated
@@ -0,0 +1,13 @@ | |||
module.exports = (sequelize, DataTypes) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'module' is not defined no-undef
} | ||
}); | ||
}, | ||
down: (queryInterface, Sequelize) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'Sequelize' is defined but never used no-unused-vars
@@ -0,0 +1,29 @@ | |||
module.exports = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'module' is not defined no-undef
Thanks alot for this. I'm really trying to decide on which |
src/routes/api/notifyRoutes.js
Outdated
@@ -0,0 +1,5 @@ | |||
import { Router } from 'express'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Parsing error: 'import' and 'export' may appear only with 'sourceType: module'
src/database/models/departments.js
Outdated
manager_email: DataTypes.TEXT | ||
}, {}); | ||
|
||
departments.associate = (models) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'models' is defined but never used no-unused-vars
src/database/models/departments.js
Outdated
@@ -0,0 +1,17 @@ | |||
module.exports = (sequelize, DataTypes) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'module' is not defined no-undef
src/tests/mocks/users.js
Outdated
@@ -0,0 +1,18 @@ | |||
export default { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Parsing error: 'import' and 'export' may appear only with 'sourceType: module'
src/services/notifyServices.js
Outdated
@@ -0,0 +1,48 @@ | |||
import Model from '../database/models'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Parsing error: 'import' and 'export' may appear only with 'sourceType: module'
src/services/websocket.js
Outdated
@@ -0,0 +1,13 @@ | |||
import { io } from '../index'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Parsing error: 'import' and 'export' may appear only with 'sourceType: module'
src/controllers/profile.js
Outdated
* @returns {Object} the new user | ||
* @description register a new client | ||
*/ | ||
static async getProfile(req, res) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Parsing error: Unexpected token getProfile
src/controllers/notifyControllers.js
Outdated
/* eslint-disable import/named */ | ||
/* eslint-disable require-jsdoc */ | ||
|
||
import models from '../models'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Parsing error: 'import' and 'export' may appear only with 'sourceType: module'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/tests/authTest.js
Outdated
it('should return an error if the token is invalid', (done) => { | ||
chai.request(app) | ||
.post(`${prefix}/auth/logout`) | ||
.set("Authorization", "Bearer hjgvju") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strings must use singlequote quotes
src/tests/authTest.js
Outdated
token = data.token; | ||
done(); | ||
}); | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing semicolon semi
src/tests/authTest.js
Outdated
.send(testuser) | ||
.end((err, res) => { | ||
const { data } = res.body; | ||
token = data.token; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use object destructuring prefer-destructuring
src/tests/authTest.js
Outdated
}); | ||
}); | ||
|
||
it('should contain a token value in its response data object', (done) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Block must not be padded by blank lines padded-blocks
src/tests/authTest.js
Outdated
}); | ||
}); | ||
|
||
it('should authenticate a user with a valid email and password', (done) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Block must not be padded by blank lines padded-blocks
src/services/websocket.js
Outdated
@@ -0,0 +1,5 @@ | |||
import { io } from '..'; | |||
|
|||
export const eventEmitter = (eventName, data) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer default export import/prefer-default-export
src/routes/api/index.js
Outdated
const foo = (io = null) => { | ||
router.use('/auth', auth); | ||
router.get('/profile/:user_id', getProfile); | ||
router.use('/request', checkToken, requestRouter(io)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'checkToken' is not defined no-undef
'requestRouter' is not defined no-undef
src/routes/api/index.js
Outdated
|
||
const { getProfile } = profileController; | ||
|
||
const router = express.Router(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'express' is not defined no-undef
src/middlewares/tokenMiddleware.js
Outdated
}); | ||
} | ||
}; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Newline required at end of file but not found eol-last
down: (queryInterface, Sequelize) => { | ||
return queryInterface.bulkDelete('notifications', null, {}); | ||
} | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Newline required at end of file but not found eol-last
src/controllers/travelControllers.js
Outdated
const travelObj = { user_id:userId, origin, destination, departure_date, travel_purpose }; | ||
|
||
const travelObj = { user_id: userId, origin, destination, departure_date, travel_purpose }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected a line break after this opening brace object-curly-newline
Expected a line break before this closing brace object-curly-newline
Line 17 exceeds the maximum line length of 100 max-len
src/controllers/travelControllers.js
Outdated
@@ -1,3 +1,5 @@ | |||
import autoBind from 'auto-bind'; | |||
import notifyServices from '../services/websocket' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'notifyServices' is defined but never used no-unused-vars
Missing semicolon semi
src/controllers/travelControllers.js
Outdated
@@ -1,3 +1,5 @@ | |||
import autoBind from 'auto-bind'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'autoBind' is defined but never used no-unused-vars
src/controllers/resetPassword.js
Outdated
sendPasswordResetEmail, | ||
receiveNewPassword | ||
} | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing semicolon semi
src/controllers/resetPassword.js
Outdated
}) | ||
|
||
.catch(() => { | ||
res.status(404).json("Invalid user") | ||
res.status(404).json("Invalid user") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing semicolon semi
Strings must use singlequote quotes
src/controllers/resetPassword.js
Outdated
const payload = jwt.decode(token, secret) | ||
if (payload.userId === user.id) { | ||
bcrypt.genSalt(10, function(err, salt) { | ||
if (err) return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing semicolon semi
src/controllers/resetPassword.js
Outdated
const secret = user.password + "-" + user.createdAt | ||
const payload = jwt.decode(token, secret) | ||
if (payload.userId === user.id) { | ||
bcrypt.genSalt(10, function(err, salt) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing space before function parentheses space-before-function-paren
Unexpected function expression prefer-arrow-callback
Unexpected unnamed function func-names
src/controllers/resetPassword.js
Outdated
}) | ||
} | ||
const secret = user.password + "-" + user.createdAt | ||
const payload = jwt.decode(token, secret) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing semicolon semi
src/controllers/resetPassword.js
Outdated
}) | ||
}) | ||
} | ||
const secret = user.password + "-" + user.createdAt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing semicolon semi
Strings must use singlequote quotes
Unexpected string concatenation prefer-template
src/controllers/resetPassword.js
Outdated
const { password } = req.body | ||
const receiveNewPassword = (req, res) => { | ||
const { userId, token } = req.params | ||
const { password } = req.body |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing semicolon semi
updatedAt: new Date(), | ||
}, | ||
], {} | ||
), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unexpected newline before ')' function-paren-newline
@@ -0,0 +1,23 @@ | |||
module.exports = { | |||
up: (queryInterface) => queryInterface.bulkInsert( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unexpected newline after '(' function-paren-newline
src/routes/api/index.js
Outdated
app.use(prefix, travel); | ||
app.use(prefix, comment); | ||
app.use(prefix, notify); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Newline required at end of file but not found eol-last
src/database/models/departments.js
Outdated
}; | ||
|
||
return departments; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Newline required at end of file but not found eol-last
src/database/models/departments.js
Outdated
manager_email: DataTypes.TEXT | ||
}, {}); | ||
|
||
departments.associate = (models) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'models' is defined but never used no-unused-vars
src/controllers/resetPassword.js
Outdated
const { userId, token } = req.params | ||
const { password } = req.body | ||
const receiveNewPassword = (req, res) => { | ||
const { userId, token } = req.params |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing semicolon semi
src/controllers/resetPassword.js
Outdated
const token = usePasswordHashToMakeToken(user) | ||
const url = getPasswordResetURL(user, token) | ||
const emailTemplate = resetPasswordTemplate(user, url) | ||
transporter(emailTemplate, res) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing semicolon semi
src/controllers/resetPassword.js
Outdated
} | ||
const token = usePasswordHashToMakeToken(user) | ||
const url = getPasswordResetURL(user, token) | ||
const emailTemplate = resetPasswordTemplate(user, url) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing semicolon semi
src/controllers/resetPassword.js
Outdated
res.status(404).json("No user with that email") | ||
} | ||
const token = usePasswordHashToMakeToken(user) | ||
const url = getPasswordResetURL(user, token) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing semicolon semi
src/controllers/resetPassword.js
Outdated
} catch (err) { | ||
res.status(404).json("No user with that email") | ||
} | ||
const token = usePasswordHashToMakeToken(user) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing semicolon semi
src/utils/messageUtils.js
Outdated
], | ||
welcome: 'Welcome to Archangel Barefoot Nomad Web App API.', | ||
signupSuccess: (email) => `You have successfully registered with this email, ${email}.`, | ||
verificationMessage: (hostUrl) => Click on this link to verify your email $ { url }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Parsing error: Unexpected token, expected ","
src/routes/api/notifyRoutes.js
Outdated
module.exports = foo; | ||
|
||
|
||
export default router; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Newline required at end of file but not found eol-last
src/routes/api/notifyRoutes.js
Outdated
const foo = (io = null) => { | ||
router.use('/auth', auth); | ||
router.get('/profile/:user_id', getProfile); | ||
router.use('/request', getToken, verifyToken, requestRouter(io)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'requestRouter' is not defined no-undef
src/routes/api/notifyRoutes.js
Outdated
|
||
|
||
const foo = (io = null) => { | ||
router.use('/auth', auth); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'auth' is not defined no-undef
src/controllers/resetPassword.js
Outdated
try { | ||
user = await queryByEmail(email) | ||
} catch (err) { | ||
res.status(404).json("No user with that email") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing semicolon semi
Strings must use singlequote quotes
src/controllers/index.js
Outdated
authControllers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unexpected line break before this closing brace object-curly-newline
src/controllers/authControllers.js
Outdated
errorResponse(res, statusCode.serverError, err.message); | ||
} | ||
}, | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Newline required at end of file but not found eol-last
src/controllers/authControllers.js
Outdated
} | ||
}, | ||
}; | ||
logout: async(req, res) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing space before function parentheses space-before-function-paren
src/controllers/authControllers.js
Outdated
} else { | ||
const token = generateToken(data.id, email, data.role, data.first_name); | ||
return successResponseWithData(res, statusCode.success, message.loginSuccess, {...data, token }); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unnecessary semicolon no-extra-semi
Unreachable code no-unreachable
src/controllers/authControllers.js
Outdated
throw new ApiErrors(message.incorrectPassword, statusCode.badRequest); | ||
} else { | ||
const token = generateToken(data.id, email, data.role, data.first_name); | ||
return successResponseWithData(res, statusCode.success, message.loginSuccess, {...data, token }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A space is required after '{' object-curly-spacing
Line 78 exceeds the maximum line length of 100 max-len
src/utils/email.js
Outdated
}; | ||
export default sendVerificationEmail; | ||
}; | ||
export default sendVerificationEmail; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Newline required at end of file but not found eol-last
src/tests/mocks/users.js
Outdated
password: 'every125', | ||
dept_id: 15327458, | ||
role: 'line_manager' | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Newline required at end of file but not found eol-last
src/services/travelServices.js
Outdated
throw err; | ||
} | ||
}, | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Newline required at end of file but not found eol-last
src/services/travelServices.js
Outdated
throw err; | ||
} | ||
}, | ||
findTravelById: async(id) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing space before function parentheses space-before-function-paren
src/services/travelServices.js
Outdated
} | ||
}, | ||
}; | ||
oneWayTripService: async(travelObj) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing space before function parentheses space-before-function-paren
src/services/emailServices.js
Outdated
try{ | ||
return await users.update(hash, { where: { id } }); | ||
}catch(err){ | ||
const updatePassword = async(hash, id) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing space before function parentheses space-before-function-paren
src/services/emailServices.js
Outdated
try { | ||
return await users.findOne({ where: { id } }); | ||
} catch (err) { | ||
throw err |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing semicolon semi
src/services/emailServices.js
Outdated
* @param {String} id - user's id | ||
* @returns {Promise} - sequelize response | ||
*/ | ||
const queryById = async(id) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing space before function parentheses space-before-function-paren
src/services/emailServices.js
Outdated
} catch (err) { | ||
throw err; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing semicolon semi
src/services/emailServices.js
Outdated
}catch(err){ | ||
throw err | ||
} | ||
const queryByEmail = async(email) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing space before function parentheses space-before-function-paren
src/utils/statusCode.js
Outdated
notFound: 404, | ||
unauthorized: 401, | ||
serverError: 500 | ||
}; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Newline required at end of file but not found eol-last
src/utils/notifyEmailUtils.js
Outdated
first_name, | ||
last_name | ||
} = userDetails; | ||
const { destination, departure_date, return_date } => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Parsing error: Unexpected token
src/utils/messageUtils.js
Outdated
invalidTravelId: 'The travel ID must be an integer value.', | ||
nonExistentTravel: 'The travel request does not exist.', | ||
emptyComment: 'comment cannot be empty.', | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Newline required at end of file but not found eol-last
src/services/deptServices.js
Outdated
} catch (err) { | ||
throw err | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing semicolon semi
Newline required at end of file but not found eol-last
src/services/deptServices.js
Outdated
try { | ||
return await users.update(hash, { where: { id } }); | ||
} catch (err) { | ||
throw err |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing semicolon semi
src/services/deptServices.js
Outdated
} catch (err) { | ||
throw err; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing semicolon semi
src/services/deptServices.js
Outdated
* @param {String} email - line-manager's email | ||
* @returns {Promise} - sequelize response | ||
*/ | ||
export const findManagerByEmail = async(email) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing space before function parentheses space-before-function-paren
src/services/authServices.js
Outdated
try { | ||
return await blacklists.create({ expired_tokens: token }) | ||
} catch (err) { | ||
throw err; | ||
} | ||
} | ||
|
||
}; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Newline required at end of file but not found eol-last
src/services/authServices.js
Outdated
comparePassword: (password, hashedPassword) => compareSync(password, hashedPassword), | ||
|
||
logoutService: async (token) => { | ||
logoutService: async(token) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing space before function parentheses space-before-function-paren
src/services/authServices.js
Outdated
} catch (err) { | ||
throw err; | ||
} | ||
updateUserById: async(hash, id) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing space before function parentheses space-before-function-paren
}, | ||
], {}), | ||
|
||
down: (queryInterface, Sequelize) => queryInterface.bulkDelete('notifications', null, {}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'Sequelize' is defined but never used no-unused-vars
src/services/authServices.js
Outdated
} catch (err) { | ||
throw err; | ||
} | ||
findUserById: async(id) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicate key 'findUserById' no-dupe-keys
Missing space before function parentheses space-before-function-paren
src/services/authServices.js
Outdated
@@ -8,13 +8,13 @@ import sendVerificationEmail from '../utils/email'; | |||
const { users, blacklists } = models; | |||
|
|||
export default { | |||
signupService: async (userObj) => { | |||
signupService: async(userObj) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing space before function parentheses space-before-function-paren
src/routes/api/travelRoute.js
Outdated
@@ -12,4 +12,4 @@ const { getToken, verifyToken } = authUtils; | |||
// handles the api home route... | |||
route.post('/onewaytrip', getToken, verifyToken, validateTravelRequest, validateResult, createOneWayTrip); | |||
|
|||
export default route; | |||
export default route; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Newline required at end of file but not found eol-last
src/routes/api/authRoutes.js
Outdated
passport.authenticate('google', { | ||
failureRedirect: '/auth/signup', | ||
successRedirect: '/requests', | ||
})); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected a newline before ')' function-paren-newline
type: Sequelize.DATE, | ||
} | ||
}), | ||
down: (queryInterface, Sequelize) => queryInterface.dropTable('users') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'Sequelize' is defined but never used no-unused-vars
type: Sequelize.DATE | ||
} | ||
}), | ||
down: (queryInterface, Sequelize) => queryInterface.dropTable('departments') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'Sequelize' is defined but never used no-unused-vars
src/controllers/travelControllers.js
Outdated
const data = await oneWayTripService(travelObj); | ||
|
||
const emailVerify = await sendVerificationEmail(email, | ||
'Travel Confirmation', message.notifyUser); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected a newline before ')' function-paren-newline
src/controllers/travelControllers.js
Outdated
|
||
const data = await oneWayTripService(travelObj); | ||
|
||
const emailVerify = await sendVerificationEmail(email, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'emailVerify' is assigned a value but never used no-unused-vars
Expected a newline after '(' function-paren-newline
src/controllers/notifyControllers.js
Outdated
} | ||
}; | ||
|
||
export const readAllNotification = async(req, res) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing space before function parentheses space-before-function-paren
- Create a table - Install dependencies and [Start #167730641]
src/services/travelServices.js
Outdated
}); | ||
} catch (error) { | ||
throw error; | ||
} | ||
}; | ||
|
||
export const approveTravel = async (id) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Parsing error: approveTravel
has already been exported. Exported identifiers must be unique.
- The push notification - The email notification Create a notifications table Install dependencies socket.io and auto-bind Prepare the server Set-up the project Display New travel Requests Add Notifications Send Push and Email Notifications [Finishes: #167730641]
- The push notification - The email notification Create a notifications table Install dependencies socket.io and auto-bind Prepare the server Set-up the project Display New travel Requests Add Notifications Send Push and Email Notifications [Finishes: #167730641]
src/tests/travel.test.js
Outdated
done(); | ||
}); | ||
}); | ||
before((done) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 2 spaces but found 4 indent
src/tests/travel.test.js
Outdated
managerToken1 = data.token; | ||
done(); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 2 spaces but found 4 indent
src/tests/travel.test.js
Outdated
const { data } = res.body; | ||
managerToken1 = data.token; | ||
done(); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 6 spaces but found 12 indent
src/tests/travel.test.js
Outdated
.end((err, res) => { | ||
const { data } = res.body; | ||
managerToken1 = data.token; | ||
done(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 8 spaces but found 16 indent
src/tests/travel.test.js
Outdated
.send(testManager1) | ||
.end((err, res) => { | ||
const { data } = res.body; | ||
managerToken1 = data.token; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 8 spaces but found 16 indent
src/tests/travel.test.js
Outdated
done(); | ||
}); | ||
}); | ||
before((done) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 2 spaces but found 4 indent
src/tests/travel.test.js
Outdated
}); | ||
|
||
describe('Testing the travel approval route', () => { | ||
let managerToken1, managerToken2; | ||
let managerToken1, managerToken2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 2 spaces but found 4 indent
src/tests/travel.test.js
Outdated
expect(res).to.have.status(401); | ||
done(); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 2 spaces but found 4 indent
src/tests/travel.test.js
Outdated
.end((err, res) => { | ||
expect(res).to.have.status(401); | ||
done(); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 6 spaces but found 12 indent
src/tests/travel.test.js
Outdated
.set('Authorization', adminToken) | ||
.end((err, res) => { | ||
expect(res).to.have.status(401); | ||
done(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 8 spaces but found 16 indent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well done bro @ChidiChuks. But I don't know how your implementation sends out the notification when a requester makes a travel request.
The Notification is meant to be sent when the request is created, but you didn't add any logic that sends it in the controller function that creates the request.
Oh. bro @chuksjoe that should have been missed out while I was resolving the conflicts. But in the meantime thanks for your observation. It has been included and a screenshot of it is above |
- The push notification - The email notification - Create a notifications table - Install dependencies socket.io and auto-bind - Prepare the server - Set-up the project - Display New travel Requests - Add Notifications - Send Push and Email Notifications [Finishes: #167730641]
src/routes/travelRoute.js
Outdated
verifyToken, | ||
verifyRole('manager'), | ||
verifyDeptManagerAndRequestStatus, | ||
approveTravelRequest, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 2 spaces but found 4 indent
src/routes/travelRoute.js
Outdated
getToken, | ||
verifyToken, | ||
verifyRole('manager'), | ||
verifyDeptManagerAndRequestStatus, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 2 spaces but found 4 indent
src/routes/travelRoute.js
Outdated
'/travel/approve_request/:travel_id', | ||
getToken, | ||
verifyToken, | ||
verifyRole('manager'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 2 spaces but found 4 indent
src/routes/travelRoute.js
Outdated
approveTravelRequest, | ||
'/travel/approve_request/:travel_id', | ||
getToken, | ||
verifyToken, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 2 spaces but found 4 indent
src/routes/travelRoute.js
Outdated
verifyDeptManagerAndRequestStatus, | ||
approveTravelRequest, | ||
'/travel/approve_request/:travel_id', | ||
getToken, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 2 spaces but found 4 indent
src/routes/travelRoute.js
Outdated
pendingManagerApproval, | ||
getUserTravelStatus, | ||
approveTravelRequest, | ||
createOneWayTrip, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 2 spaces but found 4 indent
src/tests/travel.test.js
Outdated
.request(app) | ||
.post(onewayRoute) | ||
.set('Authorization', token) | ||
.send(mutatedtravelRequest) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 6 spaces but found 12 indent
src/tests/travel.test.js
Outdated
chai | ||
.request(app) | ||
.post(onewayRoute) | ||
.set('Authorization', token) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 6 spaces but found 12 indent
src/tests/travel.test.js
Outdated
}); | ||
chai | ||
.request(app) | ||
.post(onewayRoute) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 6 spaces but found 12 indent
src/tests/travel.test.js
Outdated
}); | ||
}); | ||
chai | ||
.request(app) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 6 spaces but found 12 indent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't see the logic that sends out the notification. Maybe you omitted it @ChidiChuks
- The push notification - The email notification - Create a notifications table - Install dependencies socket.io and auto-bind - Prepare the server - Set-up the project - Display New travel Requests - Add Notifications - Send Push and Email Notifications [Finishes: #167730641]
src/tests/travel.test.js
Outdated
expect(res).to.have.status(401); | ||
done(); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 2 spaces but found 4 indent
src/tests/travel.test.js
Outdated
.end((err, res) => { | ||
expect(res).to.have.status(401); | ||
done(); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 6 spaces but found 12 indent
src/tests/travel.test.js
Outdated
.set('Authorization', token) | ||
.end((err, res) => { | ||
expect(res).to.have.status(401); | ||
done(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 8 spaces but found 16 indent
src/tests/travel.test.js
Outdated
.patch(approveRequestRoute) | ||
.set('Authorization', token) | ||
.end((err, res) => { | ||
expect(res).to.have.status(401); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 8 spaces but found 16 indent
src/tests/travel.test.js
Outdated
.request(app) | ||
.patch(approveRequestRoute) | ||
.set('Authorization', token) | ||
.end((err, res) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 6 spaces but found 12 indent
src/tests/travel.test.js
Outdated
.end((err, res) => { | ||
expect(res).to.have.status(401); | ||
done(); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 6 spaces but found 12 indent
src/tests/travel.test.js
Outdated
.set('Authorization', managerToken1) | ||
.end((err, res) => { | ||
expect(res).to.have.status(401); | ||
done(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 8 spaces but found 16 indent
src/tests/travel.test.js
Outdated
.patch(approveRequestRoute) | ||
.set('Authorization', managerToken1) | ||
.end((err, res) => { | ||
expect(res).to.have.status(401); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 8 spaces but found 16 indent
src/tests/travel.test.js
Outdated
.request(app) | ||
.patch(approveRequestRoute) | ||
.set('Authorization', managerToken1) | ||
.end((err, res) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 6 spaces but found 12 indent
src/tests/travel.test.js
Outdated
chai | ||
.request(app) | ||
.patch(approveRequestRoute) | ||
.set('Authorization', managerToken1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 6 spaces but found 12 indent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well done brother @ChidiChuks.
Please attend to the inline comments I dropped and to the Hound-CI violation flags.
src/controllers/travelControllers.js
Outdated
|
||
const emailVerify = await sendVerificationEmail(email, | ||
'Travel Confirmation', message.notifyUser); | ||
emission('here', 'we made it'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, what message are you emitting here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, what message are you emitting here?
That was me testing the feature however it haas been updated
src/routes/travelRoute.js
Outdated
@@ -1,28 +1,21 @@ | |||
import { Router } from 'express'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You did not add a line of code in this file. Please, revert the changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ChidiChuks please tidy up the commented lines
src/services/travelServices.js
Outdated
@@ -6,85 +6,64 @@ import models from '../models'; | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You did not add a line of code in this file. Please, revert changes.
src/tests/travel.test.js
Outdated
@@ -5,11 +5,11 @@ import dotenv from 'dotenv'; | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You did not add a line of code on this file. Please, revert changes.
src/controllers/notifyControllers.js
Outdated
try { | ||
const user_id = req.users.id; | ||
const allRequests = await notifications.findAll({ where: { receiver: user_id } }); | ||
return res.status(200).json({ status: 200, data: allRequests }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thought we have a function that handles responses (successResponseWithDatat
and errorResppnse
). Why use return res...
?
src/controllers/notifyControllers.js
Outdated
}, | ||
|
||
readAllNotification: async (req, res) => { | ||
try { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ChidiChuks You really put in a lot of efforts into this
Are you supposed to implement this function readAllNotification? because there is a task on the PT that has to do with reading notifications
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ChidiChuks You really put in a lot of efforts into this
Are you supposed to implement this function readAllNotification? because there is a task on the PT that has to do with reading notifications
Oh yes, I had to do this to be able to test the algorithm and see that the notification is working
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ChidiChuks You have really done a great job with the implementation of this feature, and i understand how stressful it could be spending so much time, on a task.
I left some questions for you while going through the code. Please your response is needed mainly as a form of clarity.
src/validation/travelValidation.js
Outdated
.isEmpty() | ||
.withMessage(message.emptyAccommodation) | ||
.isInt() | ||
.withMessage(message.isNotInteger) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 4 spaces but found 2 indent
src/validation/travelValidation.js
Outdated
.not() | ||
.isEmpty() | ||
.withMessage(message.emptyAccommodation) | ||
.isInt() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 4 spaces but found 2 indent
src/validation/travelValidation.js
Outdated
check('accommodation_id') | ||
.not() | ||
.isEmpty() | ||
.withMessage(message.emptyAccommodation) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 4 spaces but found 2 indent
src/validation/travelValidation.js
Outdated
.withMessage(message.emptyTravelPurpose), | ||
check('accommodation_id') | ||
.not() | ||
.isEmpty() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 4 spaces but found 2 indent
src/validation/travelValidation.js
Outdated
.isEmpty() | ||
.withMessage(message.emptyTravelPurpose), | ||
check('accommodation_id') | ||
.not() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 4 spaces but found 2 indent
src/validation/travelValidation.js
Outdated
check('return_date') | ||
.not() | ||
.isEmpty() | ||
.withMessage(message.emptyReturnDate) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 4 spaces but found 2 indent
src/validation/travelValidation.js
Outdated
.bail(), | ||
check('return_date') | ||
.not() | ||
.isEmpty() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 4 spaces but found 2 indent
src/validation/travelValidation.js
Outdated
.withMessage(message.isNotISODate) | ||
.bail(), | ||
check('return_date') | ||
.not() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 4 spaces but found 2 indent
src/validation/travelValidation.js
Outdated
.withMessage(message.emptyDepartureDate) | ||
.isISO8601() | ||
.withMessage(message.isNotISODate) | ||
.bail(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 4 spaces but found 2 indent
src/validation/travelValidation.js
Outdated
.isEmpty() | ||
.withMessage(message.emptyDepartureDate) | ||
.isISO8601() | ||
.withMessage(message.isNotISODate) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 4 spaces but found 2 indent
2d05eaa
to
07d0a3d
Compare
src/utils/messageUtils.js
Outdated
userEmailNotFound: (email) => `Sorry, there is no user with email ${email} in the database.`, | ||
userIdNotFound: (id) => `Sorry, there is no user with id: ${id} in the database.`, | ||
unregisteredEmail: (email) => `User with this email (${email}) not found in our database.`, | ||
wrongRole: (role) => `Sorry, you are not a/an ${role}.`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 2 spaces but found 4 indent
src/utils/messageUtils.js
Outdated
successfullyApproval: (requester) => `You have successfully approved a travel request from ${requester}.`, | ||
userEmailNotFound: (email) => `Sorry, there is no user with email ${email} in the database.`, | ||
userIdNotFound: (id) => `Sorry, there is no user with id: ${id} in the database.`, | ||
unregisteredEmail: (email) => `User with this email (${email}) not found in our database.`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 2 spaces but found 4 indent
src/utils/messageUtils.js
Outdated
unauthorizedCommentDelete: "comment can only be deleted by it's author", | ||
successfullyApproval: (requester) => `You have successfully approved a travel request from ${requester}.`, | ||
userEmailNotFound: (email) => `Sorry, there is no user with email ${email} in the database.`, | ||
userIdNotFound: (id) => `Sorry, there is no user with id: ${id} in the database.`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 2 spaces but found 4 indent
src/utils/messageUtils.js
Outdated
unauthorizedAccessToTravel: 'Access denied. Accessible only by travel requester or his/her line manager.', | ||
unauthorizedCommentDelete: "comment can only be deleted by it's author", | ||
successfullyApproval: (requester) => `You have successfully approved a travel request from ${requester}.`, | ||
userEmailNotFound: (email) => `Sorry, there is no user with email ${email} in the database.`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 2 spaces but found 4 indent
src/utils/messageUtils.js
Outdated
unauthorized: 'Not authorized.', | ||
unauthorizedAccessToTravel: 'Access denied. Accessible only by travel requester or his/her line manager.', | ||
unauthorizedCommentDelete: "comment can only be deleted by it's author", | ||
successfullyApproval: (requester) => `You have successfully approved a travel request from ${requester}.`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 2 spaces but found 4 indent
src/utils/messageUtils.js
Outdated
successComment: [ | ||
'You have successfully commented on a travel request.', | ||
'You have successfully retrieved all comments for this travel request.', | ||
], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 2 spaces but found 4 indent
src/utils/messageUtils.js
Outdated
// comment messages | ||
successComment: [ | ||
'You have successfully commented on a travel request.', | ||
'You have successfully retrieved all comments for this travel request.', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 4 spaces but found 8 indent
src/utils/messageUtils.js
Outdated
returnTripCreated: 'Your return trip request was created successfully.', | ||
// comment messages | ||
successComment: [ | ||
'You have successfully commented on a travel request.', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 4 spaces but found 8 indent
src/utils/messageUtils.js
Outdated
requestNotPending: 'This Travel Request is not Pending.', | ||
returnTripCreated: 'Your return trip request was created successfully.', | ||
// comment messages | ||
successComment: [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 2 spaces but found 4 indent
src/utils/messageUtils.js
Outdated
nonExistentTravel: 'The travel request does not exist.', | ||
requestNotPending: 'This Travel Request is not Pending.', | ||
returnTripCreated: 'Your return trip request was created successfully.', | ||
// comment messages |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 2 spaces but found 4 indent
src/utils/messageUtils.js
Outdated
getFeedback: (accomm) => `You have successfully retrieved feedback on our accommodation facility with name, ${accomm}.`, | ||
accommodationNotFound: 'The accommodation facility does not exist.', | ||
invalidAccommodationId: 'The Accommodation ID must be an integer value.', | ||
emptyFeedback: 'Feedback field cannot be empty.', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 2 spaces but found 4 indent
src/utils/messageUtils.js
Outdated
newFeedback: (accomm) => `You have successfully dropped a feedback on our accomodation facility with name, ${accomm}.`, | ||
getFeedback: (accomm) => `You have successfully retrieved feedback on our accommodation facility with name, ${accomm}.`, | ||
accommodationNotFound: 'The accommodation facility does not exist.', | ||
invalidAccommodationId: 'The Accommodation ID must be an integer value.', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 2 spaces but found 4 indent
src/utils/messageUtils.js
Outdated
|
||
newFeedback: (accomm) => `You have successfully dropped a feedback on our accomodation facility with name, ${accomm}.`, | ||
getFeedback: (accomm) => `You have successfully retrieved feedback on our accommodation facility with name, ${accomm}.`, | ||
accommodationNotFound: 'The accommodation facility does not exist.', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 2 spaces but found 4 indent
src/utils/messageUtils.js
Outdated
wrongRole: (role) => `Sorry, you are not a/an ${role}.`, | ||
|
||
newFeedback: (accomm) => `You have successfully dropped a feedback on our accomodation facility with name, ${accomm}.`, | ||
getFeedback: (accomm) => `You have successfully retrieved feedback on our accommodation facility with name, ${accomm}.`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 2 spaces but found 4 indent
src/utils/messageUtils.js
Outdated
unregisteredEmail: (email) => `User with this email (${email}) not found in our database.`, | ||
wrongRole: (role) => `Sorry, you are not a/an ${role}.`, | ||
|
||
newFeedback: (accomm) => `You have successfully dropped a feedback on our accomodation facility with name, ${accomm}.`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 2 spaces but found 4 indent
src/utils/messageUtils.js
Outdated
invalidToken: 'Invalid Token, please login.', | ||
invalidTravelType: 'Sorry you can only make return trip request here.', | ||
invalidTravelId: 'The travel ID must be an integer value.', | ||
invalidUserId: 'Sorry you can only create the request with the id of the logged in user.', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 2 spaces but found 4 indent
src/utils/messageUtils.js
Outdated
isNotISODate: "Your date must be of ISO8601 standard '2019-01-10'.", | ||
invalidToken: 'Invalid Token, please login.', | ||
invalidTravelType: 'Sorry you can only make return trip request here.', | ||
invalidTravelId: 'The travel ID must be an integer value.', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 2 spaces but found 4 indent
src/utils/messageUtils.js
Outdated
isNotInteger: 'You must enter a valid integer type.', | ||
isNotISODate: "Your date must be of ISO8601 standard '2019-01-10'.", | ||
invalidToken: 'Invalid Token, please login.', | ||
invalidTravelType: 'Sorry you can only make return trip request here.', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 2 spaces but found 4 indent
src/utils/messageUtils.js
Outdated
incorrectPassword: 'Sorry, the password entered is not correct.', | ||
isNotInteger: 'You must enter a valid integer type.', | ||
isNotISODate: "Your date must be of ISO8601 standard '2019-01-10'.", | ||
invalidToken: 'Invalid Token, please login.', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 2 spaces but found 4 indent
src/utils/messageUtils.js
Outdated
lineManager: 'Line manager must be present to continue', | ||
incorrectPassword: 'Sorry, the password entered is not correct.', | ||
isNotInteger: 'You must enter a valid integer type.', | ||
isNotISODate: "Your date must be of ISO8601 standard '2019-01-10'.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 2 spaces but found 4 indent
src/utils/messageUtils.js
Outdated
notifyUser: 'Your travel request has been successfully created and it is awaiting approval', | ||
lineManager: 'Line manager must be present to continue', | ||
incorrectPassword: 'Sorry, the password entered is not correct.', | ||
isNotInteger: 'You must enter a valid integer type.', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 2 spaces but found 4 indent
src/utils/messageUtils.js
Outdated
emptyTravelType: 'Sorry, travel type can not be empty.', | ||
notifyUser: 'Your travel request has been successfully created and it is awaiting approval', | ||
lineManager: 'Line manager must be present to continue', | ||
incorrectPassword: 'Sorry, the password entered is not correct.', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 2 spaces but found 4 indent
src/utils/messageUtils.js
Outdated
emptyTravelPurpose: 'You must state your travel purpose', | ||
emptyTravelType: 'Sorry, travel type can not be empty.', | ||
notifyUser: 'Your travel request has been successfully created and it is awaiting approval', | ||
lineManager: 'Line manager must be present to continue', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 2 spaces but found 4 indent
src/utils/messageUtils.js
Outdated
emptyReturnDate: 'You must state your return date', | ||
emptyTravelPurpose: 'You must state your travel purpose', | ||
emptyTravelType: 'Sorry, travel type can not be empty.', | ||
notifyUser: 'Your travel request has been successfully created and it is awaiting approval', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 2 spaces but found 4 indent
src/utils/messageUtils.js
Outdated
emptyOrigin: 'You must state your current city.', | ||
emptyReturnDate: 'You must state your return date', | ||
emptyTravelPurpose: 'You must state your travel purpose', | ||
emptyTravelType: 'Sorry, travel type can not be empty.', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 2 spaces but found 4 indent
src/utils/messageUtils.js
Outdated
emptyAccommodation: 'You must select an accommodation.', | ||
emptyComment: 'comment cannot be empty.', | ||
emptyDepartureDate: 'You must state your departure date', | ||
emptyDestination: 'You must state your destination', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 2 spaces but found 4 indent
src/utils/messageUtils.js
Outdated
diffDepartment: 'You are not in the same department as the Travel Requester.', | ||
emptyAccommodation: 'You must select an accommodation.', | ||
emptyComment: 'comment cannot be empty.', | ||
emptyDepartureDate: 'You must state your departure date', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 2 spaces but found 4 indent
src/utils/messageUtils.js
Outdated
deleteComment: 'Comment successfully deleted.', | ||
diffDepartment: 'You are not in the same department as the Travel Requester.', | ||
emptyAccommodation: 'You must select an accommodation.', | ||
emptyComment: 'comment cannot be empty.', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 2 spaces but found 4 indent
src/utils/messageUtils.js
Outdated
dateForToday: "Please your departure date must be equal to or greater than today's date.", | ||
deleteComment: 'Comment successfully deleted.', | ||
diffDepartment: 'You are not in the same department as the Travel Requester.', | ||
emptyAccommodation: 'You must select an accommodation.', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 2 spaces but found 4 indent
src/utils/messageUtils.js
Outdated
dateForFuture: 'Please enter a date greater than the departure date for return date.', | ||
dateForToday: "Please your departure date must be equal to or greater than today's date.", | ||
deleteComment: 'Comment successfully deleted.', | ||
diffDepartment: 'You are not in the same department as the Travel Requester.', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 2 spaces but found 4 indent
5c6dd8e
to
eeda180
Compare
src/utils/messageUtils.js
Outdated
commentNotFound: 'The comment does not exist.', | ||
dateForFuture: 'Please enter a date greater than the departure date for return date.', | ||
dateForToday: "Please your departure date must be equal to or greater than today's date.", | ||
deleteComment: 'Comment successfully deleted.', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 2 spaces but found 4 indent
src/utils/messageUtils.js
Outdated
noDigitInPassword: 'Password must contain at least one digit.', | ||
commentNotFound: 'The comment does not exist.', | ||
dateForFuture: 'Please enter a date greater than the departure date for return date.', | ||
dateForToday: "Please your departure date must be equal to or greater than today's date.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 2 spaces but found 4 indent
src/utils/messageUtils.js
Outdated
shortPassword: 'The length of the password must be 8 and above.', | ||
noDigitInPassword: 'Password must contain at least one digit.', | ||
commentNotFound: 'The comment does not exist.', | ||
dateForFuture: 'Please enter a date greater than the departure date for return date.', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 2 spaces but found 4 indent
src/utils/messageUtils.js
Outdated
usedEmail: (email) => `User with this email (${email}) already exist.`, | ||
shortPassword: 'The length of the password must be 8 and above.', | ||
noDigitInPassword: 'Password must contain at least one digit.', | ||
commentNotFound: 'The comment does not exist.', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 2 spaces but found 4 indent
src/utils/messageUtils.js
Outdated
invalidEmail: 'Please, enter a valid email address.', | ||
usedEmail: (email) => `User with this email (${email}) already exist.`, | ||
shortPassword: 'The length of the password must be 8 and above.', | ||
noDigitInPassword: 'Password must contain at least one digit.', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 2 spaces but found 4 indent
src/utils/messageUtils.js
Outdated
managerApproval: (pendingReq) => `You have ${pendingReq} requests requiring your approval`, | ||
managerNotFound: "Manager's detail missing", | ||
requestNotOpen: 'Your request is no longer open for editing.', | ||
requestUpdated: 'Your request has been successfully updated', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 2 spaces but found 4 indent
src/utils/messageUtils.js
Outdated
oneWayTripCreated: 'Your request has been successfully created', | ||
managerApproval: (pendingReq) => `You have ${pendingReq} requests requiring your approval`, | ||
managerNotFound: "Manager's detail missing", | ||
requestNotOpen: 'Your request is no longer open for editing.', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 2 spaces but found 4 indent
src/utils/messageUtils.js
Outdated
// Travel requests messages | ||
oneWayTripCreated: 'Your request has been successfully created', | ||
managerApproval: (pendingReq) => `You have ${pendingReq} requests requiring your approval`, | ||
managerNotFound: "Manager's detail missing", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 2 spaces but found 4 indent
src/utils/messageUtils.js
Outdated
signupSuccess: (email) => `You have successfully registered with this email, ${email}.`, | ||
// Travel requests messages | ||
oneWayTripCreated: 'Your request has been successfully created', | ||
managerApproval: (pendingReq) => `You have ${pendingReq} requests requiring your approval`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 2 spaces but found 4 indent
src/utils/messageUtils.js
Outdated
welcome: 'Welcome to Archangel Barefoot Nomad Web App API.', | ||
signupSuccess: (email) => `You have successfully registered with this email, ${email}.`, | ||
// Travel requests messages | ||
oneWayTripCreated: 'Your request has been successfully created', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 2 spaces but found 4 indent
src/utils/messageUtils.js
Outdated
@@ -37,6 +38,8 @@ export default { | |||
emptyReturnDate: 'You must state your return date', | |||
emptyTravelPurpose: 'You must state your travel purpose', | |||
emptyTravelType: 'Sorry, travel type can not be empty.', | |||
notifyUser: 'Your travel request has been successfully created and it is awaiting approval', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected indentation of 2 spaces but found 0 indent
inputting pusher trigger
0396070
to
ae666f1
Compare
}); | ||
const notificationMessage = notificationObj.dataValues; | ||
|
||
console.log(notificationMessage); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unexpected console statement no-console
) | ||
}); | ||
const notificationMessage = notificationObj.dataValues; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing spaces not allowed no-trailing-spaces
travel_id: data.dataValues.id, | ||
message: message.notificationReturnMessage( | ||
first_name, data.dataValues.origin | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unexpected newline before ')' function-paren-newline
recipient_id: dept.manager_user_id, | ||
travel_id: data.dataValues.id, | ||
message: message.notificationReturnMessage( | ||
first_name, data.dataValues.origin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'data' is not defined no-undef
const notificationObj = await createNotification({ | ||
recipient_id: dept.manager_user_id, | ||
travel_id: data.dataValues.id, | ||
message: message.notificationReturnMessage( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unexpected newline after '(' function-paren-newline
|
||
delete notificationMessage.recipient_id; | ||
notificationMessage.title = 'New Travel Request.'; | ||
console.log(`new-travel-${dept.manager_user_id}`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing semicolon semi
Unexpected console statement no-console
}); | ||
const notificationMessage = notificationObj.dataValues; | ||
|
||
console.log(notificationMessage); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unexpected console statement no-console
travel_id: data.dataValues.id, | ||
message: message.notificationTravelMessage( | ||
first_name, data.dataValues.origin | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unexpected newline before ')' function-paren-newline
const notificationObj = await createNotification({ | ||
recipient_id: dept.manager_user_id, | ||
travel_id: data.dataValues.id, | ||
message: message.notificationTravelMessage( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unexpected newline after '(' function-paren-newline
@@ -31,6 +33,29 @@ const createOneWayTrip = async(req, res) => { | |||
dept_id, | |||
}); | |||
|
|||
const dept = await getADepartment(dept_id); | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing spaces not allowed no-trailing-spaces
What does this PR do?
Have a notification created on Barefoot Nomad upon a user making a new travel request
Description of Task to be completed?
There will be two forms of notification to be implemented which are;
notifications
tablesocket.io
andauto-bind
How should this be manually tested?
Any background context you want to provide?
What are the relevant pivotal tracker stories?
#167730641
Screenshots (if appropriate)
Questions: